//
// C++ Interface: window
//
// Description: 
//
//
// Author: Os3 s.r.l. <xgui@os3.it>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifdef SWIGPYTHON
	%typemap(out) xgui::Widget * { $result = XGUIPyObjectCreate($1, false); }
	%typemap(out) xgui::Menu * { $result = XGUIPyObjectCreate($1, false); }
#endif

namespace xgui
{
	class Menu;
	class Image;
    %feature("docstring","derives from :class:`xgui.ContainerClass` ") WindowClass;
	struct WindowClass : public xgui::ContainerClass
	{
		WindowClass();
		std::string const &className();
		bool isInstanceable();
		xgui::Object * create(xgui::Object * parent, xgui::StringMap &properties);

		virtual bool canBeContainedIn(xgui::ClassInfo * c);
	};
    %feature("docstring","derives from :class:`xgui.Container` \n\n**PROPERTIES**\n\n* **text** *(RW):* sets or retrieves the text displayed on the window title bar.\n\n* **size** *(RW):* sets or retrieves the window dimensions in the format \"width height\".\n\n* **position** *(RW):* sets or retrieves the window position in the screen in the format \"x y\".If set to \"center\" then the window is positioned at the center of the screen.\n\n* **resizable** *(RW):* if set to \"1\" the window has a sizing border; if set to \"0\" the window can't be resized.\n\n* **border** *(RW):* if set to \"1\" the window has a border and a title bar; if set to \"0\" the window doesn't have any border or title bar.\n\n* **status-text** *(RW):* if set to a non-empty string then a status bar with the specified text is displayed at the bottom of the window.\n\n* **icon** *(RW):* sets or retrieves the path of the file of the image displayed on the window title bar. See also the :meth:`xgui.Window.setIcon()` method.\n\n**EVENTS**\n\n* **onclose** *(linked to* :class:`xgui.Callback` *):* fired when the window is about to be closed. Returning *xgui::EVT_BLOCK* from the callback function will prevent from closing the window.\n\n**PUSHED PROPERTIES (properties registered on all children)**\n\nnone.\n\n**METHODS**\n\n") Window;
	class Window : public xgui::Container
	{
		private:
			Window(xgui::Window * parent);
			virtual ~Window();

		public:
			%feature("docstring","shows the window and all of its children\n\n*C++*::\n\n void show(); \n\n") show;
			void show();
			%feature("docstring","returns true if the window is a modal; false otherwise.\n\n*C++*::\n\n bool isModal(); \n\n") isModal;
			bool isModal();
			%feature("docstring","exits from a modal loop, closes the related window and returns the <response> value as the return value of the :meth:`xgui.Window.modalRun()` method.\n\n*C++*::\n\n void modalReturn(int response);\n\n") modalReturn;
			void modalReturn(int response);

			%feature("docstring","returns the window child. Same as :meth:`xgui.Container.getChild()` with *\"0\"* as position in container's children list\n\n*C++*::\n\n xgui::Widget * getRootChild(); \n\n") getRootChild;
			xgui::Widget * getRootChild();
			%feature("docstring","returns the menu assigned to the window, if one exists.\n\n*C++*::\n\n xgui::Menu * getMenu();\n\n") getMenu;
			xgui::Menu * getMenu();

			%feature("docstring","maximizes the window.\n\n*C++*::\n\n void maximize(); \n\n") maximize;
			void maximize();
			%feature("docstring","minimizes the specified window and activates the next top-level window in the z-order\n\n*C++*::\n\n void minimize();\n\n") minimize;
			void minimize();
			%feature("docstring","activates and displays the window.\nIf the window is minimized or maximized, it will be restored it to its original size and position.\n\n*C++*::\n\n void restore();\n\n") restore;
			void restore();

			%feature("docstring","sets the image displayed in the window title bar.\n\n*C++*::\n\n void setIcon ( Image * img );\n\n") setIcon;
			void setIcon ( Image * img );
			%feature("docstring","returns the image displayed in the window title bar, or NULL if no image is displayed.\n\n*C++*::\n\n xgui::Image * getIcon();\n\n") getIcon;
			xgui::Image * getIcon();
	};
}

%extend xgui::Window {
        %feature("docstring","shows the window as a modal window (i.e:. this method doesn't return until the window is destroyed).\n The return value is the value passed to the :meth:`xgui.Window.modalReturn()` method.\n\n*C++*::\n\n int modalRun(); \n\n") modalRun;
        int modalRun() {
                PythonThreadsManager::AllowThreads();
                int rv = self->modalRun();
                PythonThreadsManager::DenyThreads();
                return rv;
        }

        %pythoncode {
                def __del__(self):
                        if self.valid: self.delPyOwner(self)
        }
}
%clear xgui::Widget *;
%clear xgui::Menu *;      
